<template>
  <div>
    <title-name title="推荐设计专家信息"></title-name>
    <a-form>
      <a-row>
        <a-col :md='8' :sm="8">
          <a-form-item  label="推荐设计资源名称"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入" disabled  v-model="form.resName"></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="工作单位"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入"  v-model="form.employer"></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <div style="float:left">
            <a-button type="primary" @click="clickBtn">选择</a-button><span style="font-size:12px">(从设计资源库中选择)</span>
          </div>
        </a-col>
        </a-row>
        <a-row>
        <a-col :md='8' :sm="8">
          <a-form-item  label="联系电话"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入"   v-model="form.tel"></BaseInput>
            <!-- <a-select @change="changeCompanyType" v-model="form.tel">
              <a-select-option v-for="item in companyType" :key="item.id" :value="item.id">{{item.name}}</a-select-option>
            </a-select> -->
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="邮箱"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入"  v-model="form.email"></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="毕业院校"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入"  v-model="form.graduateSchool"></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="最高学历"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <!-- <BaseInput placeholder="请输入"  v-model="form.maxEducationId"></BaseInput> -->
            <a-select v-model="form.maxEducationId" placeholder="请选择">
              <a-select-option v-for="item in educationList" :key="item.id">{{item.name}}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="专业"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入"  v-model="form.profession"></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="工作年限"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入" :maxLength="30" v-model="form.workYears" ></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="职称"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <!-- <BaseInput placeholder="请输入" v-model="form.title" ></BaseInput> -->
            <a-select v-model="form.jobTitleId">
              <a-select-option v-for="item in typeList" :key="item.id">{{item.name}}</a-select-option>
            </a-select>
          </a-form-item>
        </a-col>
        <a-col :md='8' :sm="8">
          <a-form-item  label="所属专家库名称"
            :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput placeholder="请输入" v-model="form.expertLib" ></BaseInput>
          </a-form-item>
        </a-col>
        <a-col :md='24' :sm="24">
          <a-form-item  label="注册证书情况"
            :labelCol="{ lg: { span: 2 }, sm: { span: 2 } }" 
            :wrapperCol="{ lg: { span: 16 }, sm: { span: 16 } }">
            <BaseInput type="textarea" placeholder="请输入" :maxLength="300" v-model="form.certificate"></BaseInput>
          </a-form-item>
        </a-col>
      </a-row>
    </a-form>
      <!-- <button @click="save">保存</button> -->
    
    <!-- 选择设计资源 -->
    <a-modal width="1000px" v-model="visible" title="选择设计资源" >
      
      <a-form :model="form">
        <a-row>
          <a-col :md="12" :sm="12">
            <a-form-item
                    label="设计资源名称"
                    :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }"
                    :wrapperCol="{ lg: { span: 18 }, sm: { span: 18 } }">
              <BaseInput v-model="form.name" placeholder="请输入" />
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12">
            <a-form-item
                    label="资源等级"
                    :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }"
                    :wrapperCol="{ lg: { span: 18 }, sm: { span: 18 } }">
              <BaseInput v-model="form.post"
                       placeholder="请输入" />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row>
          <a-col :md="12" :sm="12">
            <a-form-item
                    label="分公司"
                    :labelCol="{ lg: { span: 6 }, sm: { span: 6 } }"
                    :wrapperCol="{ lg: { span: 18 }, sm: { span: 18 } }">
              <a-cascader :options="treeData" placeholder="请选择" @change="onChange" />
            </a-form-item>
          </a-col>
          <a-col :md="12" :sm="12" >
            <div style="float:right">
              <a-button style="margin:0 20px" type="primary">搜索</a-button>
              <a-button >重置</a-button>
            </div>
          </a-col>
        </a-row>
      </a-form>
      <!-- <a-table
              :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
              :columns="columns"
              :data-source="dataList">
    
        <span slot="serial" slot-scope="text, record, index">{{ index + 1 }}</span>
    
        <span slot="action" slot-scope="text, record">
          <template>
          <a @click="handleEdit(record)">选择</a>
          </template>
        </span>
      </a-table> -->
    </a-modal>
  </div>
</template>

<script>
  import { getTypesLabel } from '@/api/commons'
  import { getExpertList , editExpertList} from '@/api/design/resourceRecommend/basic'
  const columns = [
    {
      title: '序号',
      scopedSlots: { customRender: 'serial' }
    },
    {
      title: '推荐设计资源名称',
      dataIndex: 'recommendResource'
    },
    {
      title: '资源类型',
      dataIndex: 'recommendLevel',
    },
    {
      title: '资源等级',
      dataIndex: 'recommendType',
    },
    {
      title: '分公司 ',
      dataIndex: 'status',
    },
    {
      title: '操作',
      dataIndex: 'action',
      width: '150px',
      scopedSlots: { customRender: 'action' }
    }
  ]
  export default {
    name:'a'+ Date.now(),
  props:["formType"],
  data(){
    this.colunms = columns
    return{
      form:{},
      visible:false,
      dataList:[],
      educationList:[],
      typeList:[],
      id:''
    }
  },
  created(){
    this.id = this.$route.query.id
    this.getTypesLabel()
    this.getExpertList()
  },
  methods:{
    clickBtn(){
      this.visible = true
    },
    getExpertList(){
      if(this.id){
        getExpertList({id:this.id}).then(res=>{
          this.form = res.data
        })
      }else{
        this.form.resName = this.formType
      }
    },
    save(){
      this.form.reCommandId = this.id
      this.form.auditStatus="0"
      editExpertList(this.form).then(res=>{

      })
    },
    getTypesLabel(){
      // 职称
      getTypesLabel({type:'15'}).then(res=>{
        this.typeList = res.data
      })
      // 学历
      getTypesLabel({type:'16'}).then(res=>{
        this.educationList = res.data
      })
    },
  }
}
</script>

<style>

</style>